package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	GoodsTitle string  `gorm:"type:varchar(20);not null;comment:商品标题"`
	GoodsPrice float64 `gorm:"type:decimal(10,2);not null;comment:商品价格"`
	GoodsSum   int     `gorm:"type:int(10);not null;comment:商品数量"`
	GoodsCover string  `gorm:"type:varchar(200);not null;comment:商品封面"`
	GoodsPay   int     `gorm:"type:int(10);not null;comment:商品状态"`
}

func (g *Goods) WhereGoods(goodId int) error {
	return DB.Debug().Where("id=?", goodId).Limit(1).Find(&g).Error
}
